//
//  AddSearchView.m
//  PropertyMananger
//
//  Created by bh on 17/2/14.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "AddSearchView.h"

@implementation AddSearchView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        UIView * bgView = [[UIView alloc]init];
        [self addSubview:bgView];
        bgView.userInteractionEnabled = YES;
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self).with.offset(0);
            make.top.equalTo(self).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW, 45));
        }];
        
        self.nameLabel = [[UILabel alloc]init];
        [bgView addSubview:self.nameLabel];
        self.nameLabel.font = BHFont(15);
        self.nameLabel.textAlignment = NSTextAlignmentLeft;
        self.nameLabel.textColor = BHColor(102, 102, 102);
        self.nameLabel.text = @"设备编号:";
        
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(bgView).with.offset(15);
            make.centerY.equalTo(bgView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(70, 30));
        }];
        
        self.searchImgView = [[UIImageView alloc]init];
        [bgView addSubview:self.searchImgView];
        self.searchImgView.userInteractionEnabled = YES;
        
        self.searchImgView.image = IMG(@"bg_search");
        
        [self.searchImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.nameLabel.mas_trailing).with.offset(0);
            make.top.equalTo(self.nameLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 100, 35));
        }];
        
        UIImageView * searchImgView = [[UIImageView alloc]init];
        [bgView addSubview:searchImgView];
        searchImgView.image = IMG(@"ico_search");
        
        [searchImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.searchImgView).with.offset(10);
            make.centerY.equalTo(self.searchImgView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        self.placeholderLabel = [[UILabel alloc]init];
        [bgView addSubview:self.placeholderLabel];
        
        self.placeholderLabel.text = @"请输入设备编号";
        self.placeholderLabel.textColor = BHColor(153, 153, 153);
        self.placeholderLabel.textAlignment = NSTextAlignmentLeft;
        self.placeholderLabel.font = BHFont(15);
        
        [self.placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(searchImgView.mas_trailing).with.offset(10);
            make.centerY.equalTo(self.searchImgView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(150, 25));
        }];
        

    }
    return self;
}

@end
